import 'dart:convert';

import 'package:ichinesereader/models/book/ProgramTypes.dart';

SchoolAdminProfileDto schoolAdminProfileDtoFromJson(String str) =>
    SchoolAdminProfileDto.fromJson(json.decode(str));

String schoolAdminProfileDtoToJson(SchoolAdminProfileDto data) =>
    json.encode(data.toJson());

class SchoolAdminProfileDto {
  SchoolAdminProfileDto(
      {this.address,
      this.city,
      this.country,
      this.district,
      this.id,
      this.phone,
      this.program,
      this.programType,
      this.schoolEmail,
      this.schoolName,
      this.schoolType,
      this.state,
      this.zipCode,
      this.disableDirectLogin});

  String? address;
  String? city;
  String? country;
  String? district;
  String? id;
  String? phone;
  String? program;
  List<ProgramType>? programType;
  List<String>? programTypeIds;
  String? schoolEmail;
  String? schoolName;
  String? schoolType;
  String? state;
  String? zipCode;
  bool? disableDirectLogin;

  factory SchoolAdminProfileDto.fromJson(Map<String, dynamic> json) =>
      SchoolAdminProfileDto(
        address: json["address"],
        city: json["city"],
        country: json["country"],
        district: json["district"],
        id: json["id"],
        phone: json["phone"],
        program: json["program"],
        programType: json["programType"] != null
            ? List<ProgramType>.from(
                json["programType"].map((x) => ProgramType.fromJson(x)))
            : null,
        schoolEmail: json["schoolEmail"],
        schoolName: json["schoolName"],
        schoolType: json["schoolType"],
        state: json["state"],
        zipCode: json["zipCode"],
        disableDirectLogin: json["disableDirectLogin"],
      );

  Map<String, dynamic> toJson() => {
        "address": address,
        "city": city,
        "country": country,
        "district": district,
        "id": id,
        "phone": phone,
        "program": program,
        "programType": programType != null
            ? List<dynamic>.from(programType!.map((x) => x.toJson()))
            : null,
        "schoolEmail": schoolEmail,
        "schoolName": schoolName,
        "schoolType": schoolType,
        "state": state,
        "zipCode": zipCode,
        "disableDirectLogin": disableDirectLogin,
      };
}
